package com.intelligentclass.repositories;

import com.intelligentclass.entity.Teacher;
import com.intelligentclass.entity.Teaching;
import org.hibernate.annotations.processing.SQL;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface TeacherRespository extends JpaRepository<Teacher, String> {
    /**
     * Get the list that contains all teachings of one teacher;
     *
     * @param tno
     * @return
     */
    @Query("SELECT t FROM Teaching t WHERE t.tno = :tno")
    public List<Teaching> findAllTeaching(@Param("tno") String tno);

    @Query("select ti.introduce from TeacherIntroduce ti where ti.tno = :tno")
    public String findTeacherIntroduce(@Param("tno") String tno);
}
